#include "tcpServer.hpp"
#include "daemon.hpp"
#include <memory>


void Usage(string proc)
{
    cout << "\nUsage\t" << proc << " serverport" << endl;
}

int main(int argc, char* argv[])
{
    if (argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERR);
    }
    uint16_t port = atoi(argv[1]);
    unique_ptr<tcpServer> tsvr(new tcpServer(port));
    tsvr->initServer();
    daemonSelf();//守护进程化
    tsvr->start();
    return 0;
}
